//
// Created by 17775 on 2025/1/6.
//

#ifndef RAYCI_COMMON_STATISTICS_CHART_H
#define RAYCI_COMMON_STATISTICS_CHART_H

#include <QWidget>
#include "../qcustomplot.h"


QT_BEGIN_NAMESPACE
namespace Ui { class Common_Statistics_Chart; }
QT_END_NAMESPACE

class Common_Statistics_Chart : public QWidget {
Q_OBJECT

signals:
    void showOptions();

public:
    explicit Common_Statistics_Chart(QWidget *parent = nullptr);
    ~Common_Statistics_Chart() override;
    void setData();
    void setName(QString name);
    void setLabel(QString xLabel, QString yLabel);
    void setYLabel(QString yLabel);
    void setTitle(QString titleName);
    void setRange();

    QCPGraph* getGraph();
    void freshChart();
    void clearChart();
    void updateStatistics(double min, double max, double average, double std);
    void updateUnit(const QString& unit);

private:
    Ui::Common_Statistics_Chart *ui;
    QCustomPlot *customPlot = nullptr;
    QCPTextElement *title = nullptr;
    QMenu *m_contextMenu = nullptr;
    QCPGraph* intensityGraph = nullptr;
};


#endif //RAYCI_COMMON_STATISTICS_CHART_H
